var tls = require('tls'),
    fs = require('fs'),
    sys = require('sys'),
    http = require('http'),
    url = require('url');


var options =
{
    cert: fs.readFileSync('cert.pem'),
    ca: fs.readFileSync('cert.pem'),
    port: 8000,
    host: '127.0.0.1'
};	

var client = this;

client.socket = tls.connect(options, function()
{
    if (client.socket.authorized)
    {
        sys.puts("Auth success, connected to TLS server");
    } else {
        sys.puts("Failed to auth TLS connection: ");
        sys.puts(client.socket.authorizationError);
    }

    client.socket.addListener('error', function()
    {

    });

    client.socket.write(server.address());
});